import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'

Vue.use(VueRouter)

const myroutes = [
  {
    path: '/',
    redirect: '/Module1',
    show: false
  },
  {
    path: '/Login',
    name: '登录',
    component: () => import('@/views/Login.vue'),
    show: false
  },
  {
    path: '/Module1',
    name: '测试模块',
    show: true,
    redirect: '/Module1/PageOne',
    fontawesome: 'el-icon-location',
    component: () => import('@/views/Home.vue'),
    meta: {
      title: '测试模块'
    },
    children: [{
      path: '/Module1/PageOne',
      name: '测试页一',
      component: () => import('@/views/PageOne.vue'),
      meta: {
        title: '测试页一'
      },
      show: true,
      fontawesome: 'el-icon-check'
    },
    {
      path: '/Module1/PageTwo',
      name: '测试页二',
      component: () => import('@/views/PageTwo.vue'),
      meta: {
        title: '测试页二'
      },
      show: true,
      fontawesome: 'el-icon-check'
    }]
  },
  {
    path: '/Module2',
    name: '配置管理',
    show: true,
    fontawesome: 'el-icon-location',
    component: () => import('@/views/Home.vue'),
    meta: {
      title: '配置管理'
    },
    children: [{
      path: '/Module2/PageThree',
      name: '配置列表',
      component: () => import('@/views/GlobalSettingPage.vue'),
      meta: {
        title: '配置列表'
      },
      show: true,
      fontawesome: 'el-icon-check'
    }]
  },
  {
    path: '/Module3',
    name: '用户管理',
    show: true,
    fontawesome: 'el-icon-location',
    component: () => import('@/views/Home.vue'),
    meta: {
      title: '用户管理'
    },
    children: [{
      path: '/Module3/UserManageList',
      name: '用户列表',
      component: () => import('@/views/UserManageList.vue'),
      meta: {
        title: '用户列表'
      },
      show: true,
      fontawesome: 'el-icon-check'
    }, {
      path: '/Module3/UserTagList',
      name: '标签列表',
      component: () => import('@/views/UserTagList.vue'),
      meta: {
        title: '标签列表'
      },
      show: true,
      fontawesome: 'el-icon-check'
    }]
  },
  {
    path: '/Module4',
    name: '数据源管理',
    show: true,
    fontawesome: 'el-icon-location',
    component: () => import('@/views/Home.vue'),
    meta: {
      title: '数据源管理'
    },
    children: [{
      path: '/Module4/DataSourceList',
      name: '分类维护',
      component: () => import('@/views/DataSourceList.vue'),
      meta: {
        title: '分类维护'
      },
      show: true,
      fontawesome: 'el-icon-check'
    },
    {
      path: '/Module4/DataSourceSetting',
      name: '数据维护',
      component: () => import('@/views/DataSourceSetting.vue'),
      meta: {
        title: '数据维护'
      },
      show: false,
      fontawesome: 'el-icon-check'
    }]
  },
  {
    path: '/Module5',
    name: '权限管理',
    show: true,
    fontawesome: 'el-icon-location',
    component: () => import('@/views/Home.vue'),
    children: [{
      path: '/Module5/UserGroupList',
      name: '用户组列表',
      component: () => import('@/views/UserGroupList.vue'),
      show: true,
      fontawesome: 'el-icon-check'
    }, {
      path: '/Module5/RoleManageList',
      name: '角色列表',
      component: () => import('@/views/RoleManageList.vue'),
      show: true,
      fontawesome: 'el-icon-check'
    }]
  },
  {
    path: '/Module6',
    name: '系统管理',
    show: true,
    fontawesome: 'el-icon-location',
    component: () => import('@/views/Home.vue'),
    children: [{
      path: '/Module6/MenuList',
      name: '菜单列表',
      component: () => import('@/views/MenuList.vue'),
      show: true,
      fontawesome: 'el-icon-check'
    }]
  }
]

const routes: Array<RouteConfig> = myroutes

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
